package com.lqq.chapter13.Atomic;

import java.util.concurrent.atomic.AtomicInteger;
/**
 * @Author lqq677
 * @Date 2021/8/13 0:07
 * @Description AtomicInteger
 */

public class AtomicIntegerTest {

    static AtomicInteger ai = new AtomicInteger(1);

    public static void main(String[] args) {

        //以原子方式将当前值递增1,返回之前的值
        System.out.println(ai.getAndIncrement()); //1

        //获取当前值。返回当前值
        System.out.println(ai.get());//2

    }
}
